<?php defined('_JEXEC') or die('Restricted access'); ?>
<?
	$edit		= JRequest::getVar('edit',true);
	$text = intval($edit) ? JText::_( 'Edit' ) : JText::_( 'New' );
    JToolBarHelper::title( JText::_( 'Tambah / Edit Data Restoran' ), 'generic.png' );

	JToolBarHelper::save();

    $config_params =& JComponentHelper::getParams( 'com_restoran' );
    $apikey = $config_params->get('api_key');
	//JToolBarHelper::apply();

if ( $edit ) {
		// for existing items the button is renamed `close`
		JToolBarHelper::cancel( 'cancel', 'Close' );
	} else {
		JToolBarHelper::cancel();
	}
 $task = JRequest::getVar('task');

      if ($task=='edit') {
          $flag = 'update';
      }
      else if ($task=='add'){
          $flag = 'insert';
      }

?>
<script language="javascript" type="text/javascript">
		var sectioncategories = new Array;
		<?php
		$i = 0;
		echo 'items = '.$items;
		foreach ($this->sectioncategories as $k=>$items) {
		
			foreach ($items as $v) {
		
				echo "sectioncategories[".$i++."] = new Array( '$k','".addslashes( $v->kota_id )."','".
				addslashes( $v->nama_kota )."' );\n\t\t";

			}
		}
		?>
		
</script>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<fieldset class="adminform">
<legend>Input Restoran</legend>
<table class="admintable">

<tr>
<td width="100" align="right" class="key">
Nama Propinsi:
</td>
<td>
<?php
echo $this->lists['nama_propinsi'];
?>
</td>
</tr>

<tr>
<td width="100" align="right" class="key">
Nama Kota:
</td>
<td>
<?
echo $this->lists['kota'];
?>
</td>
</tr>

<tr>
<td width="100" align="right" class="key">
Nama Restauran:
</td>
<td>
<input class="text_area" type="text" name="nama_rest"
id="nama_rest" size="50" maxlength="250"
value="<?php echo $this->data[1][nama_rest];?>" />
</td>
</tr>

<tr>
<td width="100" align="right" class="key">
Alamat Restauran:
</td>
<td>
<input class="text_area" type="text" name="alamat_rest"
id="alamat_rest" size="50" maxlength="250"
value="<?php echo $this->data[1][alamat_rest];?>" />
</td>
</tr>

<tr>
<td width="100" align="right" class="key">
Telp Restauran:
</td>
<td>
<input class="text_area" type="text" name="telp_rest"
id="telp_rest" size="50" maxlength="250"
value="<?php echo $this->data[1][telp_rest];?>" />
</td>
</tr>

<tr>
<td width="100" align="right" class="key">
Website Restauran:
</td>
<td>
<input class="text_area" type="text" name="website_rest"
id="website_rest" size="50" maxlength="250"
value="<?php echo $this->data[1][website_rest];?>" />
</td>
</tr>
</table>

<?
// ------- akhir dari tabel input nama, alamat hotel
?>

<fieldset class="adminform">
<legend>Detail Makanan</legend>

<table class="admintable">
<thead>
<tr>
<th width="5" align="center" class="key">
<?php echo JText::_( 'No' ); ?>
</th>
<th width="20" align="center" class="key">
<?php echo JText::_( 'Nama Makanan' ); ?>
</th>
<th width="5" align="center" class="key" colspan="2">
<?php echo JText::_( 'Harga' ); ?>
</th>
</tr>
</thead>

<tr>
<td>
<input class="text_area" type="text" name="no_1"
id="no_1" size="5" maxlength="5"
value="1" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="makanan_1"
id="makanan_1" size="50" maxlength="250"
value="<?php echo $this->data[1][makanan_1];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_makanan_1"
id="harga_makanan_1" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_makanan_1];?>" />
</td>

</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_2"
id="no_2" size="5" maxlength="5"
value="2" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="makanan_2"
id="makanan_2" size="50" maxlength="250"
value="<?php echo $this->data[1][makanan_2];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_makanan_2"
id="harga_makanan_2" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_makanan_2];?>" />
</td>
</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_3"
id="no_3" size="5" maxlength="5"
value="3" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="makanan_3"
id="makanan_3" size="50" maxlength="250"
value="<?php echo $this->data[1][makanan_3];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_makanan_3"
id="harga_makanan_3" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_makanan_3];?>" />
</td>
</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_4"
id="no_4" size="5" maxlength="5"
value="4" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="makanan_4"
id="makanan_4" size="50" maxlength="250"
value="<?php echo $this->data[1][makanan_4];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_makanan_4"
id="harga_makanan_4" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_makanan_4];?>" />
</td>
</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_5"
id="no_5" size="5" maxlength="5"
value="5" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="makanan_5"
id="makanan_5" size="50" maxlength="250"
value="<?php echo $this->data[1][makanan_5];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_makanan_5"
id="harga_makanan_5" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_makanan_5];?>" />
</td>
</tr>

</table>
</fieldset>

<?
// ------- akhir dari tabel input detail makanan
?>
<fieldset class="adminform">
<legend>Detail Minuman</legend>

<table class="admintable">
<thead>
<tr>
<th width="5" align="center" class="key">
<?php echo JText::_( 'No' ); ?>
</th>
<th width="20" align="center" class="key">
<?php echo JText::_( 'Nama Minuman' ); ?>
</th>
<th width="5" align="center" class="key" colspan="2">
<?php echo JText::_( 'Harga' ); ?>
</th>
</tr>
</thead>

<tr>
<td>
<input class="text_area" type="text" name="no_1"
id="no_1" size="5" maxlength="5"
value="1" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="minuman_1"
id="minuman_1" size="50" maxlength="250"
value="<?php echo $this->data[1][minuman_1];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_minuman_1"
id="harga_minuman_1" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_minuman_1];?>" />
</td>

</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_2"
id="no_2" size="5" maxlength="5"
value="2" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="minuman_2"
id="minuman_2" size="50" maxlength="250"
value="<?php echo $this->data[1][minuman_2];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_minuman_2"
id="harga_minuman_2" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_minuman_2];?>" />
</td>
</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_3"
id="alamat_rest" size="5" maxlength="5"
value="3" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="minuman_3"
id="minuman_3" size="50" maxlength="250"
value="<?php echo $this->data[1][minuman_3];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_minuman_3"
id="harga_minuman_3" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_minuman_3];?>" />
</td>
</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_4"
id="no_4" size="5" maxlength="5"
value="4" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="minuman_4"
id="minuman_4" size="50" maxlength="250"
value="<?php echo $this->data[1][minuman_4];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_minuman_4"
id="harga_minuman_4" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_minuman_4];?>" />
</td>
</tr>

<tr>
<td>
<input class="text_area" type="text" name="no_5"
id="no_5" size="5" maxlength="5"
value="5" disabled="disabled" />
</td>
<td>
<input class="text_area" type="text" name="minuman_5"
id="minuman_5" size="50" maxlength="250"
value="<?php echo $this->data[1][minuman_5];?>" />
</td>
<td width="2" align="left">
<?php echo JText::_( 'Rp' ); ?>
</td>
<td>
<input class="text_area" type="text" name="harga_minuman_5"
id="harga_minuman_5" size="11" maxlength="250"
value="<?php echo $this->data[1][harga_minuman_5];?>" />
</td>
</tr>

</table></fieldset>

</fieldset>

<input type="hidden" name="api" value="<?php echo $apikey; ?>" />
<input type="hidden" name="option" value="com_restoran" />
<input type="hidden" name="id_rest" value="<?php echo $this->data[1][id_rest]; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="formrestoran" />
<input type="hidden" name="view" value="restoran" />
<input type="hidden" name="flag" value="<?echo $flag;?>" />
<input type="hidden" name="tujuan" value="food" />
</form>
